package com.shanshaogang.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.shanshaogang.services.ChagreService;


/**
 * Servlet implementation class Internet
 */
public class Internet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session = request.getSession();
		String dd = session.getAttribute("dd").toString();
		String jg = session.getAttribute("jg").toString();
		String zf = session.getAttribute("zf").toString();
		String sd = session.getAttribute("sd").toString();
		System.out.println(dd);
		System.out.println(jg);
		System.out.println(zf);
		System.out.println(sd);
		ChagreService cs = new ChagreService();
		cs.add(dd, jg, zf, Integer.parseInt(sd));
//		response.sendRedirect("http://www.baidu.com");
		response.sendRedirect("http://192.168.137.252:5051/Recharge.html");
//		http://192.168.137.252:5051/Recharge.html
	}

}
